package com.example.test.service.impl;

import com.example.test.mapper.StudentMapper;
import com.example.test.pojo.Student;
import com.example.test.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Cavan
 * @date 2023-06-14
 * @qq 2069543852
 */
@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentMapper studentMapper;

    //根据id查询信息
    @Override
    public Student getStuById(String id) {
        Student stuById = studentMapper.getStuById(id);
        return stuById;
    }

    //查询所有信息
    @Override
    public List<Student> getAllStu() {
        List<Student> allStu = studentMapper.getAllStu();
        return allStu;
    }

    //添加信息
    @Override
    public int insert(Student student) {
        int result = studentMapper.insert(student);
        return result;
    }

    //根据id修改信息
    @Override
    public int updateById(Student student) {
        int result = studentMapper.updateById(student);
        return result;
    }

    //根据id删除信息
    @Override
    public int deleteById(String id) {
        int result = studentMapper.deleteById(id);
        return result;
    }

}
